/**
 * Copyright &copy; 2016-2017 <a href="https://www.lczyfz.com">联创智云</a> All rights reserved.
 */
package com.lczyfz.campusinfo.modules.campusinfohelp.web;

import com.lczyfz.campusinfo.common.persistence.Page;
import com.lczyfz.campusinfo.common.utils.ApiResultUtils;
import com.lczyfz.campusinfo.common.web.BaseController;
import com.lczyfz.campusinfo.modules.campusinfohelp.entity.CampusinfoHelp;
import com.lczyfz.campusinfo.modules.campusinfohelp.service.CampusinfoHelpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * 帮助中心Controller
 * @author zms
 * @version 2018-04-16
 */
@Controller
@RequestMapping(value = "api/campusinfohelp/campusinfoHelp")
public class CampusinfoApiHelpControllerpi extends BaseController {

	@Autowired
	private CampusinfoHelpService campusinfoHelpService;
	@RequestMapping(value = "helpList")
    @ResponseBody
	public Map<String, Object> gethelp(CampusinfoHelp campusinfoHelp, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<CampusinfoHelp> page = campusinfoHelpService.findPage(new Page<CampusinfoHelp>(request, response), campusinfoHelp); 
		model.addAttribute("page", page);
        Map<String, Object> map = ApiResultUtils.getBaseMapSuccess();
        map.put("page", page.getList());
        map.put("pageNo", page.getPageNo());
        map.put("count", page.getCount());
        map.put("totalPage",page.getTotalPage());
        return map;
	}
    @RequestMapping(value = "findById")
    @ResponseBody
    public Map<String, Object> findById(CampusinfoHelp campusinfoHelp, HttpServletRequest request, HttpServletResponse response, Model model) {
        CampusinfoHelp page = campusinfoHelpService.get(campusinfoHelp);
        Map<String, Object> map = ApiResultUtils.getBaseMapSuccess();
        map.put("page", page);
        return map;
    }

}